import bpy
from bpy.types import Operator
import 全局控制.Node.节点和插座基类.bl_节点基类 as 基类

def f_update(self, context):
	if self.m_物体 != None :
		self.m_物体.display.show_shadows = False
		self.m_物体.display_type = 'WIRE'
	#print(self.m_物体)

class C_SceneNode_逐帧执行(bpy.types.Node):
	bl_dname = 'bl_node_逐帧执行'
	bl_label = '逐帧执行'

	m_帧间隔 = bpy.props.IntProperty(name='间隔', default=0)
	m_物体 = bpy.props.PointerProperty(name='物体', type=bpy.types.Object, update=f_update)
	
	def init(self, context):
		super(C_SceneNode_逐帧执行, self).__init__()
		self.inputs.new('C_NodeSocket_物体', name='要更新节点:')

	def draw_buttons(self, context, layout):
		layout.prop(self, "m_帧间隔")
	
	def update(self):
		print('更新域')




class C_NODE_MENU_逐帧执行(bpy.types.Operator):
	bl_idname = 'node.global_node_object_frame_by_frame'
	bl_label = 'Add 逐帧执行'
	bl_options = {'REGISTER', 'UNDO'}

	def execute(operator, context):
		operator.use_transform = True
		bpy.ops.node.add_node(type='C_SceneNode_逐帧执行', use_transform=True)
		return {'FINISHED'}



classes = (
	C_SceneNode_逐帧执行,
	C_NODE_MENU_逐帧执行,
)

def register():
	for c in classes:
		bpy.utils.register_class(c)
		

def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)

	

